<div class="user-profile">
    <div class="container">
        <div class="row">
            <div class="span12">            	
                <ul class="breadcrumb">
                    <li class="previous"><a href="<?php echo SITE_URL; ?>">Home /</a></li>                        
                    <li class="disable"><a href="javascript:void(0)">My Profile</a></li>
                </ul>                    
            </div>

            <div class="span12">            	

                <div class="whiteBg padding20px addmarginB20">
                    <?php echo CHtml::link('Edit Profile', $this->createAbsoluteUrl('profile/updateprofile'), array('class' => 'btn floatR')); ?>
                    <h5 class="fnt-size20">My Profile</h5>                        
                    <div class="clear"></div>
                </div>


                <div class="whiteBg padding20px">
                    <div class="col col1"> 
                        <!--Trainer Image Section-->           	
                        <div class="featureImg">                            
                            <img src="<?php
                    echo baseUrl() . '../../' . getUploadDir();
                    echo ($profiles->photo != '') ? $profiles->user_id . '/profile/432X324/' . $profiles->photo : 'default-male.jpg';
                    ?>">	     
                        </div>
                        <!--End Trainer Image Section-->
                    </div>
                    <div class="col col2">
                        <!--Trainer Detail Section-->
                        <div class="detailBox">            		
                            <h4 class="txt676 fnt-size20 lineH20px addpaddingB5"><?php echo $profiles->first_name . '  ' . $profiles->last_name; ?></h4>
                            <div class="height1px borBgren addmarginB14"></div>
                            <p class="fnt-size18 addmarginB15"><span class="txtgreen font-opensansbd">Member since</span> <?php echo date('d M Y', $profiles->user->createtime); ?></p>
                            <div class="height1px borBgren addmarginB14"></div>
                            <ul class="trainerSocial">
                                <li><a href="<?php echo $profiles->facebook; ?>" class="social-sprite fb-icon">facebook</a></li>
                                <li><a href="<?php echo $profiles->twitter; ?>" class="social-sprite twitter-icon">twitter</a></li>
                                <li><a href="<?php echo $profiles->linkedin; ?>" class="social-sprite linkd-icon">share</a></li>       
                            </ul>
                            <div class="height1px borBgren addmarginB14"></div>                    
                            <div class="clear"></div>
                            <a href="javascript:void(0)" class="btn-green addmarginB10" onclick="checkProfile('Classes/Create');">Create a Class </a>
                            <a href="javascript:void(0)" class="btn-green  addmarginB10" onclick="checkProfile('Courses/Create');">Create a Course</a>
                            <?php ##echo CHtml::link('Create Course', $this->createAbsoluteUrl('../Courses/Create'), array('class' => 'btn-green addmarginB10')); ?>
                            <div id="AjaxLoader" style="display:none;" align="center">&nbsp;<img src="<?php echo ThemePath(); ?>/images/fancybox_loading@2x.gif" align="absmiddle"></div>
                            <div id="formResult" class="errorMessage"></div>
                        </div>
                        <!--End Trainer Detail Section-->
                    </div>
                    <div class="clear"></div>
                </div>

            </div>
        </div>
    </div>
</div>
<section class="contentCntr whiteBg noRadius">
    <div class="container">
        <div class="row">
            <div class="span12"> 
                <!--Content Area-->
                <div class="descriptionArea">           	
                    <ul class="nav nav-tabs" id="myTab">
                        <li class="active"><a href="#aboutus" data-toggle="tab">About</a></li>
                        <li><a href="#experience" data-toggle="tab">Experience</a></li>
                        <li><a href="#otherinformation" data-toggle="tab">Other Information</a></li>
                    </ul>
                    <div id="contentBox" class="tab-content">
                        <div class="tab-pane active" id="aboutus">
                            <?php echo $profiles->about; ?>

                        </div>
                        <div class="tab-pane" id="experience">
                            <?php echo $profiles->experience; ?>

                        </div>
                        <div class="tab-pane" id="otherinformation">
                            <?php echo $profiles->other_info; ?>

                        </div>



                    </div>				
                </div>    
                <!--End Of Content Area-->    
            </div>                        
        </div>
    </div>    
</section>

<section class="contentCntr">
    <div class="container">
        <div class="row">
            <div class="span5">
                <!--Review Box-->
                <div class="reviewBox">  
                    <div id="reviewDiv">              	
                        <h4 class="txttTransformNorml addpaddingB20">Reviews<span class="rbutton"> <a class="carousel-control left" href="#reviewCarousel" data-slide="prev"><img src="<?php echo ThemePath(); ?>/images/slide-left.png" /></a><a class="carousel-control right" href="#reviewCarousel" data-slide="next"><img src="<?php echo ThemePath(); ?>/images/slide-right.png" /></a></span></h4>
                        <?php /* ---------render page reviewpage for view all  review start ---------------- */ ?>
                        <?php $this->renderPartial('//trainerProfileReview/_viewReview', array('profiles' => $profiles)); ?>
                        <?php /* ---------render page reviewpage end---------------- */ ?>

                    </div>

                </div>
                <!--End of Review Box-->    
            </div>
            <div class="span7">
                <!--Recommend Box-->
                <h4 class="font-opensanslt txt000 fnt-size26 remmarginT txttTransformNorml addpaddingB10 fntweghtNml">Reviews and Recommendations</h4>
                <div class="recommendBox-inner">

                    <div class="contents">
                        <div class="floatL">
                            <h4><?php echo (!empty($classtotalCountTrainerate)) ? $classtotalCountTrainerate . '<br>Recommendations' : 'No Recommendations'; ?></h4>
                            <p class="padding10px font-opensansilt fnt-size20 whiteBg inline-block noRadius"><?php echo (!empty($classTrainerRate)) ? $classTrainerRate . '% Positive' : '0% Positive'; ?></p>
                        </div>
                        <img class="floatR" src="<?php echo ThemePath(); ?>/images/recomend-hand.png" />
                    </div>

                </div>
                <!--End of Recommend Box-->
            </div>
        </div>
    </div>
</section>

<?php
$allClassCourseInfo = array();
$classDetails = literalEndingTommorow('', '', '');
$courseDetails = runningCurrentCoursesByUser('', '', ''); //Null parameter means these value $profiles, $userType, $getValue)
$allClassCourseInfo = array_merge($classDetails, $courseDetails);
usort($allClassCourseInfo, 'date_compare');
$validatedata = literalendingtommorowValiadte($allClassCourseInfo);
if (!empty($validatedata)) {
    $this->renderPartial('//classes/literallyEndingtomorrow', array('allClassCourseInfo' => $allClassCourseInfo));
}
?>
<script type="text/javascript" src="<?php echo ThemePath(); ?>/js/jquery.nicescroll.js"></script>
<script>
    jQuery(document).ready(function() {
        jQuery('#reviewCarousel').carousel({
            interval: 4000
        })

    });
    jQuery(document).ready(function($) {
        $('.crsl-items1').respCaro({overflow: false, visible: 3, itemMinWidth: 300, itemMargin: 20, autoRotate: 4000});
        $('.crsl-items2').respCaro({overflow: false, visible: 3, itemMinWidth: 300, itemMargin: 20, autoRotate: 5000});
    });
    function checkProfile(action) {
        jQuery.ajax({
            'type': 'POST',
            'url': "<?php echo Yii::app()->createAbsoluteUrl("user/profile/checkProfile"); ?>",
            'data': 'action=' + action,
            'beforeSend': function(jqXHR, settings) {
                $("#AjaxLoader").show();
            },
            'success': function(data) {
                $("#AjaxLoader").hide();
                if (data == 1) {
                    $("#formResult").html("Frist complete your profile.");
                    window.setTimeout(function() {
                        $("#AjaxLoader").show();
                        window.location.href = '<?php echo Yii::app()->createAbsoluteUrl("user/profile/updateprofile"); ?>';
                    }, 5000);
                }
                else {
                    window.location.href = data;
                }
            },
            'cache': false
        });
    }
</script>
